package com.ayf.payment.game.api.utils;

/**
 * @author wwl
 * @description:
 * @date 2021/4/13 15:27
 */
public class test {

    public static void main(String[] args) {
       String numStr="1878";
       String[] numArry=numStr.split("");
       int  len=numArry.length;
        for (int i = 0; i < len; i++) {
            if (!numArry[i].equals("0") && numArry[i].length() > 0) {
                int snumber=Integer.parseInt( numArry[i]);
                    if (snumber >= 5) {
                        String s5 = snumber / 5 + "" + getZeroByNum(len - i - 1);
                        System.out.println("5" + getZeroByNum(len - i - 1) + "=" + snumber / 5);
                        snumber = snumber % 5;

                    }
                    if (snumber >= 2) {
                        String s2 = "";
                        if((len - i - 1)>1){
                            System.out.println(snumber+getZeroByNum(len - i - 1) +"="+snumber);
                            snumber=0;
                        }else {
                            if (len - i - 1 > 0) {

                                s2 = snumber / 2 + "" + getZeroByNum(len - i - 1);
                                System.out.println("2" + getZeroByNum(len - i - 1) + "=" + (snumber / 2));
                                snumber = snumber % 2;
                            }
                        }
                    }
                    String s1 = "";
                    if (snumber > 0) {
                        if (len - i - 1 > 0) {
                            s1 = "1" + getZeroByNum(len - i - 1);
                            System.out.println("1" + getZeroByNum(len - i - 1) + "=" + snumber);
                        } else {
                            System.out.println("0" + "=" + snumber);
                        }

                    }
                }
        }

    }

    private static String getZeroByNum(int len){
        if (len <= 0) {
            return "";
        }
        StringBuffer zb=new StringBuffer();
        for (int j = 0; j < len; j++) {
            zb.append("0");
        }
        return zb.toString();
    }
}
